/*
 * LED.c
 *
 *  Created on: 30.01.2011
 *      Author: Tavin
 */


#include <stdint.h>

#include "board.h"
#include "gpio.h"
#include "StatusCodes.h"

#include "LED.h"


unsigned int ledMap[LED_COUNT]={LED_0,LED_1,LED_2,LED_3};

void LED_init()
{
uint8_t ledCounter;




	 for (ledCounter=0;ledCounter<LED_COUNT;ledCounter++)
	 {
		 gpio_local_enable_pin_output_driver(ledMap[ledCounter]);
		 //gpio_enable_gpio_pin(ledMap[ledCounter]);
		 LED_off(ledCounter);
		 }


}

uint16_t LED_on(uint8_t ledNumber)
{
	if (ledNumber >= LED_COUNT)
		return(STCD_LED_UNKNOWN);

	gpio_local_clr_gpio_pin(ledMap[ledNumber]);

return(STCD_OK);
}



uint16_t LED_off(uint8_t ledNumber)
{
	if (ledNumber >= LED_COUNT)
		return(STCD_LED_UNKNOWN);

	gpio_local_set_gpio_pin(ledMap[ledNumber]);

return(STCD_OK);
}



uint16_t LED_toggle(uint8_t ledNumber)
{
	if (ledNumber >= LED_COUNT)
		return(STCD_LED_UNKNOWN);

	gpio_tgl_gpio_pin(ledMap[ledNumber]);

return(STCD_OK);
}

